﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="copyright" content="yy"/>
    <title>兆龙食品厂ERP系统 v1.0</title>
    <link rel="stylesheet" type="text/css"
          href="${root!}/easyui/1.3.4/themes/metro/easyui.css"/>
    <link rel="stylesheet" type="text/css"
          href="${root!}/resource/css/wu.css"/>
    <link rel="stylesheet" type="text/css"
          href="${root!}/resource/css/icon.css"/>
    <script type="text/javascript"
            src="${root!}/easyui/1.3.4/jquery.min.js"></script>
    <script type="text/javascript"
            src="${root!}/easyui/1.3.4/jquery.easyui.min.js"></script>
    <script type="text/javascript"
            src="${root!}/easyui/1.3.4/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="${root!}/js/ui.js"></script>
    <script type="text/javascript">
        Number.prototype.toFixed = function (d) {
            var s = this + "";
            if (!d)d = 0;
            if (s.indexof(".") == -1)s += ".";
            s += new Array(d + 1).join("0");
            if (new Regexp("^(-|\\+)?(\\d+(\\.\\d{0," + (d + 1) + "})?)\\d*$").test(s)) {
                var s = "0" + Regexp.$2, pm = Regexp.$1, a = Regexp.$3.length, b = true;
                if (a == d + 2) {
                    a = s.match(/\d/g);
                    if (parseInt(a[a.length - 1]) > 4) {
                        for (var i = a.length - 2; i >= 0; i--) {
                            a[i] = parseInt(a[i]) + 1;
                            if (a[i] == 10) {
                                a[i] = 0;
                                b = i != 1;
                            } else break;
                        }
                    }
                    s = a.join("").replace(new Regexp("(\\d+)(\\d{" + d + "})\\d$"), "$1.$2");
                }
                if (b)s = s.substr(1);
                return (pm + s).replace(/\.$/, "");
            }
            return this + "";
        };
        $.fn.serializeObject = function () {
            var o = {};
            var a = this.serializeArray();
            $.each(a, function () {
                if (o[this.name] !== undefined) {
                    if (!o[this.name].push) {
                        o[this.name] = [o[this.name]];
                    }
                    o[this.name].push(this.value || '');
                } else {
                    o[this.name] = this.value || '';
                }
            });
            return o;
        }</script>
</head>
<body class="easyui-layout">
<!-- begin of header -->
<div class="wu-header"
     data-options="region:'north',border:false,split:true">
    <div class="wu-header-left">
        <h1>兆龙食品厂ERP系统v1.0</h1>
    </div>
    <div class="wu-header-right">
        <p>
            <strong class="easyui-tooltip" title="2条未读消息">${(usrinfo.fullName)!}</strong>，欢迎您！
        </p>

        <p>
            <!--<a href="#">网站首页</a>|<a href="#">支持论坛</a>|<a href="#">帮助中心</a>|-->

            <a class="login_out" href="${root!}/auth/doLoginOut">安全退出</a>
        </p>
    </div>
</div>
<!-- end of header -->
<!-- begin of sidebar -->
<div class="wu-sidebar"
     data-options="region:'west',split:true,border:true,title:'导航菜单'">


    <div class="easyui-accordion" data-options="border:false,fit:true">
        <#if menus?? >
            <#list menus as menu>
                <div title="${menu.menuName!}" data-options="iconCls:'${menu.icon!}'"
                     style="padding: 5px;">
                    <#if menu.subMenu??>
                        <ul class="easyui-tree wu-side-tree">
                            <#list menu.subMenu as submenu>
                                <li iconCls="${submenu.icon!}"><a href="javascript:void(0)"
                                                                  data-link="${root!}${submenu.url!}" iframe="0">${submenu.menuName}</a>
                                </li>
                            </#list>
                        </ul>
                    </#if>

                </div>
            </#list>
        </#if>
    </div>
</div>
<!-- end of sidebar -->
<!-- begin of main -->
<div class="wu-main" data-options="region:'center'">
    <div id="wu-tabs" class="easyui-tabs"
         data-options="border:false,fit:true">
        <div title="首页"
             data-options="href:'${root!}/home',closable:false,iconCls:'icon-tip',cls:'tabpanel'"></div>
    </div>
</div>
<!-- end of main -->
<!-- begin of footer -->
<div class="wu-footer"
     data-options="region:'south',border:true,split:true">&copy; 2017
</div>
<!-- end of footer -->
<script type="text/javascript">
    $(function () {
        $('.wu-side-tree li').bind("click", function () {
            var $a = $(this).find('a');
            var title = $a.text();
            var url = $a.attr('data-link');
            var iconCls = $a.attr('data-icon');
            var iframe = $a.attr('iframe') == 1 ? true : false;
            addTab(title, url, iconCls, iframe);
        });
    })

    //    /**
    //     * Name 载入树形菜单
    //     */
    //    console.log(${root!});
    //    $('#wu-side-tree').tree({
    //        url: '${root!}/resouce/temp/menu.php',
    //        cache: false,
    //        onClick: function (node) {
    //            var url = node.attributes['url'];
    //            if (url == null || url == "") {
    //                return false;
    //            }
    //            else {
    //                addTab(node.text, url, '', node.attributes['iframe']);
    //            }
    //        }
    //    });

    /**
     * Name 选项卡初始化
     */
    $('#wu-tabs').tabs({
        tools: [
            {
                iconCls: 'icon-reload',
                border: false,
                handler: function () {
                    $('#wu-datagrid').datagrid('reload');
                }
            }
        ]
    });

    /**
     * Name 添加菜单选项
     * Param title 名称
     * Param href 链接
     * Param iconCls 图标样式
     * Param iframe 链接跳转方式（true为iframe，false为href）
     */
    function addTab(title, href, iconCls, iframe) {
        var tabPanel = $('#wu-tabs');
        if (!tabPanel.tabs('exists', title)) {
            var content = '<iframe scrolling="auto" frameborder="0"  src="' + href + '" style="width:100%;height:100%;"></iframe>';
            if (iframe) {
                tabPanel.tabs('add', {
                    title: title,
                    content: content,
                    iconCls: iconCls,
                    fit: true,
                    cls: 'tabpanel',
                    closable: true
                });
            }
            else {
                tabPanel.tabs('add', {
                    title: title,
                    href: href,
                    iconCls: iconCls,
                    fit: true,
                    cls: 'tabpanel',
                    closable: true
                });
            }
        }
        else {
            tabPanel.tabs('select', title);
        }
    }
    /**
     * Name 移除菜单选项
     */
    function removeTab() {
        var tabPanel = $('#wu-tabs');
        var tab = tabPanel.tabs('getSelected');
        if (tab) {
            var index = tabPanel.tabs('getTabIndex', tab);
            tabPanel.tabs('close', index);
        }
    }
</script>
</body>
</html>
